package cn.anecansaitin.firecrafting.client.crafting;

import cn.anecansaitin.firecrafting.ModConstant;
import cn.anecansaitin.firecrafting.api.client.crafting.IJEIRecipeRender;
import cn.anecansaitin.firecrafting.api.common.crafting.IFireRecipe;
import cn.anecansaitin.firecrafting.common.crafting.FireEnergyRecipe;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiComponent;
import net.minecraft.network.chat.TextComponent;

public class FireEnergyRecipeRender implements IJEIRecipeRender {
    //这个类只需要一个就可以了，因此将构造函数设为private并提供一个静态实现。
    public static final FireEnergyRecipeRender INSTANCE = new FireEnergyRecipeRender();

    private FireEnergyRecipeRender(){}

    @Override
    public void drawBeforeFire(IFireRecipe recipe, PoseStack stack, double mouseX, double mouseY) {
        //绑定渲染的贴图
        RenderSystem.setShaderTexture(0, ModConstant.JEI_GUI);
        //渲染
        GuiComponent.blit(stack, 145, 34, 179, 54, 10, 18, 256, 256);
        //渲染文字
        GuiComponent.drawCenteredString(stack, Minecraft.getInstance().font, new TextComponent(((FireEnergyRecipe) recipe).getOutputs() + " FE").withStyle(ChatFormatting.YELLOW), 151, 55, 0x000000);
    }
}
